/**字典通用操作------start--------**/
var Dic = {}
Dic.getDicBytpe = function(type) {
	var dic = {};
	ajaxs("/dic/searchByType/" + type, "GET", {}, false, function(data) {
		if(data) {
			for(var i in data) {
				dic[data[i].key] = data[i].value;
			}
		}
    });
	return dic;
}

Dic.fillSelect = function(type, selector) {
	$(selector).empty();
	var dic = Dic.getDicBytpe(type);
	for(var i in dic) {
		$(selector).append("<option value='" + i + "'>" + dic[i] + "</option>")
	}
}
/**字典通用操作----end------**/
/**所属客户通用操作---start-----**/
var Rent = {};
Rent.fillSelect = function(selector) {
	$(selector).empty();
	ajaxs("/DRent/forSelect", "GET", {}, false, function(data) {
		if(data) {
			for(var i in data) {
				$(selector).append("<option value='" + data[i].rentCode + "'>" + data[i].rentName + "</option>");
			}
		}
    });
}
/**所属客户通用操作-----end-----**/

/**所属机构通用操作---start-----**/
var Org = {};
Org.fillSelect = function(rentCode, selector) {
	$(selector).empty();
	ajaxs("/DOrg/forSelect/" + rentCode, "GET", {}, false, function(data) {
		if(data) {
			for(var i in data) {
				$(selector).append("<option value='" + data[i].orgCode + "'>" + data[i].orgName + "</option>");
			}
		}
    });
}
/**所属客户通用操作-----end-----**/


$.fn.serializeJson = function() {
	var formserializeArray = $(this).serializeArray();   
	var jsonObj = {};
	jQuery.map(formserializeArray , function (n, i) {
		if(jsonObj[n.name]) {
			var old = jsonObj[n.name];
			jsonObj[n.name] = [];
			jsonObj[n.name].push(old);
			jsonObj[n.name].push(n.value);
		} else {
			jsonObj[n.name] = n.value;
		}
	});
	return jsonObj;
}